projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d35c4ee
)
* src/haikufont.c (haikufont_draw): Allocate string buffer on stack.
author
Po Lu
<luangruo@yahoo.com>
Thu, 3 Feb 2022 10:34:50 +0000
(10:34 +0000)
committer
Po Lu
<luangruo@yahoo.com>
Thu, 3 Feb 2022 10:34:50 +0000
(10:34 +0000)
src/haikufont.c
patch
|
blob
|
history
diff --git
a/src/haikufont.c
b/src/haikufont.c
index 67b1113e44c904bf097844ce16f9ec8f29763099..1ef5f54c9aa8bce016b8af2e233c94972bc95a21 100644
(file)
--- a/
src/haikufont.c
+++ b/
src/haikufont.c
@@
-1000,12
+1000,13
@@
haikufont_draw (struct glyph_string *s, int from, int to,
else
{
ptrdiff_t b_len = 0;
- char *b =
xmalloc (b_len
);
+ char *b =
alloca ((to - from + 1) * MAX_MULTIBYTE_LENGTH
);
for (int idx = from; idx < to; ++idx)
{
int len = CHAR_STRING (s->char2b[idx], mb);
- b = xrealloc (b, b_len = (b_len + len));
+ b_len += len;
+
if (len == 1)
b[b_len - len] = mb[0];
else
@@
-1013,7
+1014,6
@@
haikufont_draw (struct glyph_string *s, int from, int to,
}
BView_DrawString (view, b, b_len);
- xfree (b);
}
unblock_input ();